package com.huazi.eduservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huazi.commonutils.CommentResult;
import com.huazi.eduservice.entity.EduTeacher;
import com.huazi.eduservice.mapper.EduTeacherMapper;
import com.huazi.eduservice.service.EduTeacherService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 讲师 服务实现类
 * </p>
 *
 * @author huazi
 * @since 2021-03-12
 */
@Service
public class EduTeacherServiceImpl extends ServiceImpl<EduTeacherMapper, EduTeacher> implements EduTeacherService {
    //首页信息缓存
    @Cacheable(key = "'getIndexTeachers'",value = "teacher")
    @Override
    public CommentResult getIndexTeachers(Integer current, Integer size) {
        Page<EduTeacher> page=new Page<>(current,size);
        baseMapper.selectPage(page,null);
        return CommentResult.getOK().data("getIndexTeachers" ,page);
    }
    //讲师列表查询
    @Override
    public CommentResult getTeacherLists(Integer current, Integer size) {
        Page<EduTeacher> page=new Page<>(current,size);
        baseMapper.selectPage(page,null);
        return CommentResult.getOK().data("getTeacherLists" ,page);
    }
}
